package com.zkw.group.service;

import com.zkw.group.entity.CourseBook;
import com.zkw.group.mapper.CourseBookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseBookService {

    @Autowired
    private CourseBookMapper courseBookMapper;

    //分页获取课程有关参考书目列表
    public List<CourseBook> getAllCourseBookList(String bookname, String courseid, int pageStart, int pageSize){
        return courseBookMapper.getAllCourseBookList(bookname,courseid,pageStart,pageSize);
    }

    //获取课程有关参考书目条目数
    public int getCourseBookCounts(String bookname,String courseid){
        return  courseBookMapper.getCourseBookCounts(bookname,courseid);
    }

    //添加课程有关参考书目
    public int addCourseBook(CourseBook courseBook){
        return courseBookMapper.addCourseBook(courseBook);
    }

    //删除指定课程有关参考书目
    public int deleteCourseBook(String bookname){
        return courseBookMapper.deleteCourseBook(bookname);
    }

    //获取要更新的课程有关参考书目信息以及更新指定课程参考书目信息
    public CourseBook getUpdateCourseBook(String courseid,String bookname){
        return courseBookMapper.getUpdateCourseBook(courseid,bookname);
    }

    public int updateCourseBook(CourseBook courseBook){
        return courseBookMapper.updateCourseBook(courseBook);
    }
}
